3.1 \(\int \frac {(A+B x) (a+b x+c x^2)}{d+f x^2} \, dx\)

Optimal. Leaf size=94 \[ -\frac {\tan ^{-1}\left (\frac {\sqrt {f} x}{\sqrt {d}}\right ) (-a A f+A c d+b B d)}{\sqrt {d} f^{3/2}}-\frac {\log \left (d+f x^2\right ) (-a B f-A b f+B c d)}{2 f^2}+\frac {x (A c+b B)}{f}+\frac {B c x^2}{2 f} \]

[Out]

(A*c+B*b)*x/f+1/2*B*c*x^2/f-1/2*(-A*b*f-B*a*f+B*c*d)*ln(f*x^2+d)/f^2-(-A*a*f+A*c*d+B*b*d)*arctan(x*f^(1/2)/d^(
1/2))/f^(3/2)/d^(1/2)

________________________________________________________________________________________

Rubi [A]  time = 0.11, antiderivative size = 94, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 4, integrand size = 25, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.160, Rules used = {1629, 635, 205, 260} \[ -\frac {\log \left (d+f x^2\right ) (-a B f-A b f+B c d)}{2 f^2}-\frac {\tan ^{-1}\left (\frac {\sqrt {f} x}{\sqrt {d}}\right ) (-a A f+A c d+b B d)}{\sqrt {d} f^{3/2}}+\frac {x (A c+b B)}{f}+\frac {B c x^2}{2 f} \]

Antiderivative was successfully verified.

[In]

Int[((A + B*x)*(a + b*x + c*x^2))/(d + f*x^2),x]

[Out]

((b*B + A*c)*x)/f + (B*c*x^2)/(2*f) - ((b*B*d + A*c*d - a*A*f)*ArcTan[(Sqrt[f]*x)/Sqrt[d]])/(Sqrt[d]*f^(3/2))
- ((B*c*d - A*b*f - a*B*f)*Log[d + f*x^2])/(2*f^2)

Rule 205

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[a/b, 2]*ArcTan[x/Rt[a/b, 2]])/a, x] /; FreeQ[{a, b}, x]
&& PosQ[a/b]

Rule 260

Int[(x_)^(m_.)/((a_) + (b_.)*(x_)^(n_)), x_Symbol] :> Simp[Log[RemoveContent[a + b*x^n, x]]/(b*n), x] /; FreeQ
[{a, b, m, n}, x] && EqQ[m, n - 1]

Rule 635

Int[((d_) + (e_.)*(x_))/((a_) + (c_.)*(x_)^2), x_Symbol] :> Dist[d, Int[1/(a + c*x^2), x], x] + Dist[e, Int[x/
(a + c*x^2), x], x] /; FreeQ[{a, c, d, e}, x] &&  !NiceSqrtQ[-(a*c)]

Rule 1629

Int[(Pq_)*((d_) + (e_.)*(x_))^(m_.)*((a_) + (c_.)*(x_)^2)^(p_.), x_Symbol] :> Int[ExpandIntegrand[(d + e*x)^m*
Pq*(a + c*x^2)^p, x], x] /; FreeQ[{a, c, d, e, m}, x] && PolyQ[Pq, x] && IGtQ[p, -2]

Rubi steps

\begin {align*} \int \frac {(A+B x) \left (a+b x+c x^2\right )}{d+f x^2} \, dx &=\int \left (\frac {b B+A c}{f}+\frac {B c x}{f}-\frac {b B d+A c d-a A f+(B c d-A b f-a B f) x}{f \left (d+f x^2\right )}\right ) \, dx\\ &=\frac {(b B+A c) x}{f}+\frac {B c x^2}{2 f}-\frac {\int \frac {b B d+A c d-a A f+(B c d-A b f-a B f) x}{d+f x^2} \, dx}{f}\\ &=\frac {(b B+A c) x}{f}+\frac {B c x^2}{2 f}-\frac {(b B d+A c d-a A f) \int \frac {1}{d+f x^2} \, dx}{f}-\frac {(B c d-A b f-a B f) \int \frac {x}{d+f x^2} \, dx}{f}\\ &=\frac {(b B+A c) x}{f}+\frac {B c x^2}{2 f}-\frac {(b B d+A c d-a A f) \tan ^{-1}\left (\frac {\sqrt {f} x}{\sqrt {d}}\right )}{\sqrt {d} f^{3/2}}-\frac {(B c d-A b f-a B f) \log \left (d+f x^2\right )}{2 f^2}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 0.07, size = 86, normalized size = 0.91 \[ \frac {\log \left (d+f x^2\right ) (a B f+A b f-B c d)-\frac {2 \sqrt {f} \tan ^{-1}\left (\frac {\sqrt {f} x}{\sqrt {d}}\right ) (-a A f+A c d+b B d)}{\sqrt {d}}+f x (2 A c+2 b B+B c x)}{2 f^2} \]

Antiderivative was successfully verified.

[In]

Integrate[((A + B*x)*(a + b*x + c*x^2))/(d + f*x^2),x]

[Out]

(f*x*(2*b*B + 2*A*c + B*c*x) - (2*Sqrt[f]*(b*B*d + A*c*d - a*A*f)*ArcTan[(Sqrt[f]*x)/Sqrt[d]])/Sqrt[d] + (-(B*
c*d) + A*b*f + a*B*f)*Log[d + f*x^2])/(2*f^2)

________________________________________________________________________________________

fricas [A]  time = 0.86, size = 200, normalized size = 2.13 \[ \left [\frac {B c d f x^{2} + 2 \, {\left (B b + A c\right )} d f x - {\left (A a f - {\left (B b + A c\right )} d\right )} \sqrt {-d f} \log \left (\frac {f x^{2} - 2 \, \sqrt {-d f} x - d}{f x^{2} + d}\right ) - {\left (B c d^{2} - {\left (B a + A b\right )} d f\right )} \log \left (f x^{2} + d\right )}{2 \, d f^{2}}, \frac {B c d f x^{2} + 2 \, {\left (B b + A c\right )} d f x + 2 \, {\left (A a f - {\left (B b + A c\right )} d\right )} \sqrt {d f} \arctan \left (\frac {\sqrt {d f} x}{d}\right ) - {\left (B c d^{2} - {\left (B a + A b\right )} d f\right )} \log \left (f x^{2} + d\right )}{2 \, d f^{2}}\right ] \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((B*x+A)*(c*x^2+b*x+a)/(f*x^2+d),x, algorithm="fricas")

[Out]

[1/2*(B*c*d*f*x^2 + 2*(B*b + A*c)*d*f*x - (A*a*f - (B*b + A*c)*d)*sqrt(-d*f)*log((f*x^2 - 2*sqrt(-d*f)*x - d)/
(f*x^2 + d)) - (B*c*d^2 - (B*a + A*b)*d*f)*log(f*x^2 + d))/(d*f^2), 1/2*(B*c*d*f*x^2 + 2*(B*b + A*c)*d*f*x + 2
*(A*a*f - (B*b + A*c)*d)*sqrt(d*f)*arctan(sqrt(d*f)*x/d) - (B*c*d^2 - (B*a + A*b)*d*f)*log(f*x^2 + d))/(d*f^2)
]

________________________________________________________________________________________

giac [A]  time = 0.15, size = 87, normalized size = 0.93 \[ -\frac {{\left (B b d + A c d - A a f\right )} \arctan \left (\frac {f x}{\sqrt {d f}}\right )}{\sqrt {d f} f} - \frac {{\left (B c d - B a f - A b f\right )} \log \left (f x^{2} + d\right )}{2 \, f^{2}} + \frac {B c f x^{2} + 2 \, B b f x + 2 \, A c f x}{2 \, f^{2}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((B*x+A)*(c*x^2+b*x+a)/(f*x^2+d),x, algorithm="giac")

[Out]

-(B*b*d + A*c*d - A*a*f)*arctan(f*x/sqrt(d*f))/(sqrt(d*f)*f) - 1/2*(B*c*d - B*a*f - A*b*f)*log(f*x^2 + d)/f^2
+ 1/2*(B*c*f*x^2 + 2*B*b*f*x + 2*A*c*f*x)/f^2

________________________________________________________________________________________

maple [A]  time = 0.03, size = 133, normalized size = 1.41 \[ \frac {A a \arctan \left (\frac {f x}{\sqrt {d f}}\right )}{\sqrt {d f}}-\frac {A c d \arctan \left (\frac {f x}{\sqrt {d f}}\right )}{\sqrt {d f}\, f}-\frac {B b d \arctan \left (\frac {f x}{\sqrt {d f}}\right )}{\sqrt {d f}\, f}+\frac {B c \,x^{2}}{2 f}+\frac {A b \ln \left (f \,x^{2}+d \right )}{2 f}+\frac {A c x}{f}+\frac {B a \ln \left (f \,x^{2}+d \right )}{2 f}+\frac {B b x}{f}-\frac {B c d \ln \left (f \,x^{2}+d \right )}{2 f^{2}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((B*x+A)*(c*x^2+b*x+a)/(f*x^2+d),x)

[Out]

1/2*B*c*x^2/f+1/f*A*c*x+1/f*b*B*x+1/2/f*ln(f*x^2+d)*A*b+1/2/f*ln(f*x^2+d)*B*a-1/2/f^2*ln(f*x^2+d)*B*c*d+1/(d*f
)^(1/2)*arctan(x*f/(d*f)^(1/2))*A*a-1/f/(d*f)^(1/2)*arctan(x*f/(d*f)^(1/2))*A*c*d-1/f/(d*f)^(1/2)*arctan(x*f/(
d*f)^(1/2))*B*b*d

________________________________________________________________________________________

maxima [A]  time = 0.97, size = 84, normalized size = 0.89 \[ \frac {{\left (A a f - {\left (B b + A c\right )} d\right )} \arctan \left (\frac {f x}{\sqrt {d f}}\right )}{\sqrt {d f} f} + \frac {B c x^{2} + 2 \, {\left (B b + A c\right )} x}{2 \, f} - \frac {{\left (B c d - {\left (B a + A b\right )} f\right )} \log \left (f x^{2} + d\right )}{2 \, f^{2}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((B*x+A)*(c*x^2+b*x+a)/(f*x^2+d),x, algorithm="maxima")

[Out]

(A*a*f - (B*b + A*c)*d)*arctan(f*x/sqrt(d*f))/(sqrt(d*f)*f) + 1/2*(B*c*x^2 + 2*(B*b + A*c)*x)/f - 1/2*(B*c*d -
 (B*a + A*b)*f)*log(f*x^2 + d)/f^2

________________________________________________________________________________________

mupad [B]  time = 3.44, size = 97, normalized size = 1.03 \[ \frac {x\,\left (A\,c+B\,b\right )}{f}-\frac {\mathrm {atan}\left (\frac {\sqrt {f}\,x}{\sqrt {d}}\right )\,\left (A\,c\,d-A\,a\,f+B\,b\,d\right )}{\sqrt {d}\,f^{3/2}}+\frac {B\,c\,x^2}{2\,f}+\frac {\ln \left (f\,x^2+d\right )\,\left (4\,A\,b\,d\,f^3+4\,B\,a\,d\,f^3-4\,B\,c\,d^2\,f^2\right )}{8\,d\,f^4} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(((A + B*x)*(a + b*x + c*x^2))/(d + f*x^2),x)

[Out]

(x*(A*c + B*b))/f - (atan((f^(1/2)*x)/d^(1/2))*(A*c*d - A*a*f + B*b*d))/(d^(1/2)*f^(3/2)) + (B*c*x^2)/(2*f) +
(log(d + f*x^2)*(4*A*b*d*f^3 + 4*B*a*d*f^3 - 4*B*c*d^2*f^2))/(8*d*f^4)

________________________________________________________________________________________

sympy [B]  time = 1.85, size = 333, normalized size = 3.54 \[ \frac {B c x^{2}}{2 f} + x \left (\frac {A c}{f} + \frac {B b}{f}\right ) + \left (\frac {A b f + B a f - B c d}{2 f^{2}} - \frac {\sqrt {- d f^{5}} \left (A a f - A c d - B b d\right )}{2 d f^{4}}\right ) \log {\left (x + \frac {- A b d f - B a d f + B c d^{2} + 2 d f^{2} \left (\frac {A b f + B a f - B c d}{2 f^{2}} - \frac {\sqrt {- d f^{5}} \left (A a f - A c d - B b d\right )}{2 d f^{4}}\right )}{A a f^{2} - A c d f - B b d f} \right )} + \left (\frac {A b f + B a f - B c d}{2 f^{2}} + \frac {\sqrt {- d f^{5}} \left (A a f - A c d - B b d\right )}{2 d f^{4}}\right ) \log {\left (x + \frac {- A b d f - B a d f + B c d^{2} + 2 d f^{2} \left (\frac {A b f + B a f - B c d}{2 f^{2}} + \frac {\sqrt {- d f^{5}} \left (A a f - A c d - B b d\right )}{2 d f^{4}}\right )}{A a f^{2} - A c d f - B b d f} \right )} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((B*x+A)*(c*x**2+b*x+a)/(f*x**2+d),x)

[Out]

B*c*x**2/(2*f) + x*(A*c/f + B*b/f) + ((A*b*f + B*a*f - B*c*d)/(2*f**2) - sqrt(-d*f**5)*(A*a*f - A*c*d - B*b*d)
/(2*d*f**4))*log(x + (-A*b*d*f - B*a*d*f + B*c*d**2 + 2*d*f**2*((A*b*f + B*a*f - B*c*d)/(2*f**2) - sqrt(-d*f**
5)*(A*a*f - A*c*d - B*b*d)/(2*d*f**4)))/(A*a*f**2 - A*c*d*f - B*b*d*f)) + ((A*b*f + B*a*f - B*c*d)/(2*f**2) +
sqrt(-d*f**5)*(A*a*f - A*c*d - B*b*d)/(2*d*f**4))*log(x + (-A*b*d*f - B*a*d*f + B*c*d**2 + 2*d*f**2*((A*b*f +
B*a*f - B*c*d)/(2*f**2) + sqrt(-d*f**5)*(A*a*f - A*c*d - B*b*d)/(2*d*f**4)))/(A*a*f**2 - A*c*d*f - B*b*d*f))

________________________________________________________________________________________